package top.noteday.controller;

import java.util.List;
import java.util.Date;
import entity.Page;
import entity.result.EntityResult;
import org.springframework.beans.factory.annotation.Autowired;
import entity.result.PageResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.PostMapping;
import entity.value.*;
import top.noteday.impl.ValueServiceImpl;

// TODO 修改 value
@RestController
@RequestMapping(value = "/backstage/value")
public class ValueServiceController {

    @Autowired
    private ValueServiceImpl valueService;

    /**
     * 查询一个
     */
    @PostMapping(value = "/selectById")
    public Value selectById(@RequestParam("id") Integer id) {
        return valueService.selectById(id);
    }

    /**
     * 保存数据
     */
    @PostMapping(value = "/saveValues")
    public int saveValues(@RequestBody Value value) {
        return valueService.saveValues(value);
    }

    /**
     * 获取详情
     */
    @PostMapping(value = "/getFormValue")
    EntityResult<ValueDto> getFormValue(@RequestBody ValueVo vo) {
        return valueService.getFormValue(vo);
    }

    /**
     * 分页查询
     */
    /*
    @PostMapping(value = "/selectValue")
    PageResult<ValueDto> selectValue(@RequestBody ValueVo valueVo) {
        return valueService.selectValue(valueVo);
    }
    */
}
